<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>商品列表</h2>
	</div>
	<div class="cf">
		<div class="fl">
			<a class="btn" href="{:U('addAdvs')}">新 增</a>
            <button class="btn ajax-post confirm" url="{:U('deleteAdvs')}" target-form="ids">删 除</button>
        </div>

       <!-- 高级搜索 -->
		<div class="search-form fr cf">
			<div class="sleft">
				<select name="pid">
					<option value="">全部</option>
					<volist name="position_list" id="vo">
						<option value="{$vo.position_id}" <if condition="I('get.pid') eq $vo['position_id']">selected</if>>{$vo.position_name}</option>
					</volist>
				</select>
			</div>

			<div class="btn-group-click adv-sch-pannel fl">
				<button class="btn" id="search">搜 索</button>
			</div>
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
		<th class="">id</th>
		<th class="">广告位</th>
		<th class="">广告名称</th>
		<th class="">缩略图</th>
		<th class="">排序</th>
		<th class="">广告链接</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
			<td>{$vo.id} </td>
			<td>{$position_list[$vo['pid']]['position_name']}</td>
			<td>{$vo.ad_name}</td>
			<td><img width="100" height="50" src="{$vo['thumb']}"></td>
			<td>{$vo.orderby}</td>
			<td>{$vo.ad_link}</td>
			<td>
				<a href="{:U('editAdvs?id='.$vo['id'])}">编辑</a>
			 	<a href="{:U('deleteAdvs?ids='.$vo['id'])}" class="confirm ajax-get">删除</a>
            </td>
		</tr>
		</volist>
		<else/>
		<td colspan="8" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
	<script type="text/javascript">
        //搜索功能
        $("#search").click(function(){
            var url ="{:U('index')}";
            var query  = $('.search-form').find('select').serialize();;
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
        //导航高亮
        highlight_subnav('{:U("index")}');
	</script>
</block>
